package lib

import "fruit/net/tcp"

type lib_tcp_mgr struct {
	tcp_server *tcp.TcpServer
}

var lib_tcp lib_tcp_mgr

func func_tcp_listen() {
	if lib_tcp.tcp_server != nil {
		return
	}
	lib_tcp.tcp_server = tcp.Listen("127.0.0.1:8888", nil)
}

func (my *lib_tcp_mgr) close() {
	if my.tcp_server != nil {
		tcp.Close(my.tcp_server)
		my.tcp_server = nil
	}
}
